package com.linfeng.component.mybatisplus.executor.cmd;

import com.linfeng.component.mybatisplus.entity.IEntity;
import com.linfeng.component.mybatisplus.event.cmd.CreateCmd;
import org.springframework.beans.factory.annotation.Autowired;

public abstract class CreateCmdExe<C extends CreateCmd,E extends IEntity> {

    @Autowired
    protected E entity;

    public boolean execute(C cmd) {

        handlerCmd(cmd);

        return entity.create(cmd);
    }

    public void handlerCmd(C cmd) {

        cmd.setCreatorId(1L);
    }
}
